package fr.generali.accueilclient.gwt.client.state.store;

import java.util.HashMap;

import com.google.gwt.core.client.Callback;

import fr.generali.accueilclient.gwt.client.state.StateStore;

public class HashMapStateStore implements StateStore {

	private final HashMap<String, String> map;

	public HashMapStateStore() {
		map = new HashMap<String, String>();
	}

	@Override
	public void clear(String name) {
		map.remove(name);
	}

	@Override
	public void get(String name, Callback<String, Throwable> callback) {
		callback.onSuccess(map.get(name));
	}

	@Override
	public void set(String name, String value) {
		map.put(name, value);
	}

	@Override
	public void clear() {
		map.clear();
	}
	
}
